unit SmallStruct.Core.TSSObjectContext;

interface

uses Classes,
  SmallStruct.Core,
  SmallStruct.Core.TSSObject,
  SmallStruct.Core.TSSObjectContainer,
  SmallStruct.Configuration.TSSConfiguration;

type
  TSSObjectContext = class(TSSObject, ISSObjectContext)
  private
    _Configuration: TSSConfiguration;
    _Parameter: TSSObjectContainer;
  public
    function GetConfiguration: ISSConfiguration; virtual;
    function GetParameter: ISSObjectContainer;
  public
    procedure SetConfiguration(AConfiguration: ISSConfiguration); virtual;
  public
    constructor Create(AOwner: TComponent); override;
    destructor Destroy; override;
  end;

implementation

{ TSSObjectContext }

constructor TSSObjectContext.Create(AOwner: TComponent);
begin
  inherited;
  _Parameter := TSSObjectContainer.Create(Self);
end;

function TSSObjectContext.GetParameter: ISSObjectContainer;
begin
  Result := _Parameter;
end;

destructor TSSObjectContext.Destroy;
begin
  _Parameter.Free;
  _Configuration.Free;
  inherited;
end;

function TSSObjectContext.GetConfiguration: ISSConfiguration;
begin
  Result := _Configuration;
end;

procedure TSSObjectContext.SetConfiguration(AConfiguration: ISSConfiguration);
begin
  _Configuration := AConfiguration.GetObjectInstance as TSSConfiguration;
end;

end.
